﻿#pragma once

#include "UI/CNumEdit.h"
#include "UI/MyDialog.h"
#include "UI/MyBtn.h"
#include "MainFrm.h"
// CPrintSetDlg 对话框

class CPrintSetDlg : public CMyDialog
{
	DECLARE_DYNAMIC(CPrintSetDlg)

public:
	CPrintSetDlg(CWnd* pParent = nullptr);   // 标准构造函数
	virtual ~CPrintSetDlg();

// 对话框数据
//#ifdef AFX_DESIGN_TIME
	enum { IDD = IDD_PRINT_SET_DLG };
//#endif

protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持

	DECLARE_MESSAGE_MAP()
private:
	int					m_nPrintRow;
	int					m_nPrintCol;
	CNumEdit			m_editMarginTop;
	CNumEdit			m_editMarginLeft;
	CNumEdit			m_editMarginBottom;
	CNumEdit			m_editMarginRight;
	CSpinButtonCtrl		m_spinRow;
	CSpinButtonCtrl		m_spinCol;
	CButton				m_btnPrintPage;
	int					m_nStartPage;
	CButton				m_btnPrintHeader;
	CButton				m_btnPrintFooter;
	CString				m_strHeader;
	CString				m_strFooter;

	CMyBtn				m_btnDefault;
	CMyBtn				m_btnPrintView;
	CMyBtn				m_btnPrint;

	CMainFrame*			m_PreFrame;							// 打印预览对话框

	void				GetNextValue(CEdit* edit, const int & nFlag);
	void				SetEdit(CNumEdit* edit, const double& dValue);

	void				LoadSetting();
	void				SaveSetting();

	void				PrintImg();
public:
	int					m_nPrint;
	CArray<int, int>	m_ArrGJSel;
	void				OnPrint(CDC *pDC, CPrintInfo *pInfo);
public:
	virtual BOOL OnInitDialog();
	afx_msg void OnBnClickedCheckPrintPage();
	afx_msg void OnBnClickedCheckPrintHeader();
	afx_msg void OnBnClickedCheckPrintFooter();
	afx_msg void OnDeltaposSpinMarginTop(NMHDR *pNMHDR, LRESULT *pResult);
	afx_msg void OnDeltaposSpinMarginBottom(NMHDR *pNMHDR, LRESULT *pResult);
	afx_msg void OnDeltaposSpinMarginLeft(NMHDR *pNMHDR, LRESULT *pResult);
	afx_msg void OnDeltaposSpinMarginRight(NMHDR *pNMHDR, LRESULT *pResult);
	afx_msg void OnBnClickedOk();
	afx_msg void OnBnClickedCancel();
	afx_msg void OnBnClickedButtonPrintView();
	afx_msg void OnBnClickedButtonPrint();
	afx_msg void OnClose();
	afx_msg void OnBnClickedButtonPrintDefault();
};
